<?php 
require_once("../../includes/_ClsCon.php");
$db = new MySQLi('localhost','root','12345','notarios');
$_obj   = new _ClsCon();        
	
	$estado 			= $_POST['estado'];
	$numformu 			= $_REQUEST['numformu'];
	$pcapaz 			= $_REQUEST['pcapaz'];
	$direccionca		= $_REQUEST['direccionca'];
	$rangoca1 	 		= $_REQUEST['rangoca1'];
	$rangoca2  			= $_REQUEST['rangoca2'];
	$db = new MySQLi('localhost','root','12345','notarios');
	$limite				= $_POST['limite'];

	$query2 = "SELECT id_supervivencia FROM cert_supervivencia";
	$res2=$db->query($query2);
	$total=$res2->num_rows;
	
	$paginas=ceil($total/17);
	
    $query = "CALL spLisPCapaz('".$numformu."' ,'".$pcapaz."' ,'".$direccionca."' ,'".$rangoca1."','".$rangoca2."','".$estado."',".$limite.")";
	
	$res = $db->query($query);
	//var_dump($consulta_poderes);
	//exit();
if($res2->num_rows){
	while ($rowkar = $res->fetch_array())
{	



$nomyape1=strtoupper($rowkar['nombre']);
	$textorefe1=str_replace("?","'",$nomyape1);
	$textoampers1=str_replace("*","&",$textorefe1);
	$textoamperss1=str_replace("ñ","Ñ",$textoampers1);
	$refii1=strtoupper($textoamperss1);
	
	$nomyape=strtoupper($rowkar['direccion']);
	$textorefe=str_replace("?","'",$nomyape);
	$textoampers=str_replace("*","&",$textorefe);
	$textoamperss=str_replace("ñ","Ñ",$textoampers);
	$refii=strtoupper($textoamperss);
	
	
			$numkar = $rowkar['num_crono'];
			$numkar2 = substr($numkar,5,6).'-'.substr($numkar,0,4);
			
$fecha = $rowkar['fecha'];
$fecha1 = explode ("-",$fecha);
$fecha2 = $fecha1[2] . "/" . $fecha1[1] . "/" . $fecha1[0];


$capaz[$rowkar['id_supervivencia']]= "<table width='858' border='1' cellpadding='0' cellspacing='0' bordercolor='#333333' >
  <tr>
    <td width='63' align='center' ><span class='reskar'><a href='EditPCapazVie.php?id_supervivencia=".$rowkar['id_supervivencia']."'>".$numkar2."</a></span></td>
	<td width='86' align='center' ><span class='reskar'>".$fecha2."</span></td>
	<td width='150' align='center' ><span class='reskar'>".$refii1."</span></td>
	<td width='86' align='center' ><span class='reskar'>".$refii."</span></td>
    <td width='73' align='center'><span class='reskar'>".$rowkar['swt_capacidad']."</span></td>
  </tr>
</table>";
}
}

foreach($capaz as $cap){
	
	echo "<article >".$cap."</article>";
	}		

echo "<table width='300' border='0' cellspacing='0'cellpadding='0'>
  <tr>
    <td width='45'>"; if ($limite>0){
	
	$limit=$limite-17;
	echo "<input type='hidden' value='".$limit."' id='_imagen' /><aside onClick=\"cargakardex(".$limit.")\"><img src='../../ante.png' width='37' height='36' border='0' title='Anterior'></aside>";
	
	}else{
		echo "<input type='hidden' value='".$limit."' id='_imagen' /><aside></aside>";
		}  echo"</td>
    		<td width='100'>";
			echo "total de pag :"." ".$paginas;
			echo"</td>
    <td width='50'>"; 
	
	if ($limite<$total-17){
	
	$limit=$limite+17;
	echo "<aside onClick=\"cargakardex(".$limit.")\"><img  src='../../sigte.png' width='37' height='36' border='0' title='Siguiente'></aside>";
	
	}else{
		echo "<aside></aside>";
		}
	
	echo"</td>
  </tr>
</table>";

?>
